package com.jumi.microservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jumi.microservice.entity.JmRealnameAuthentication;
import com.jumi.microservice.entity.JmRealnameAuthenticationLog;
import com.jumi.microservice.entity.JmUser;
import com.jumi.microservice.mapper.JmRealnameAuthenticationMapper;
import com.jumi.microservice.service.IJmRealnameAuthenticationLogService;
import com.jumi.microservice.service.IJmRealnameAuthenticationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jumi.microservice.service.PageService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * <p>
 * 用户实名认证表 服务实现类
 * </p>
 *
 * @author 要挑客户管理团队
 * @since 2020-08-03
 */
@Service
public class JmRealnameAuthenticationServiceImpl extends ServiceImpl<JmRealnameAuthenticationMapper, JmRealnameAuthentication> implements IJmRealnameAuthenticationService{

    @Resource
    JmRealnameAuthenticationMapper mapper;

    @Resource
    IJmRealnameAuthenticationLogService logService;

    @Override
    public Page getPage(Page page, Wrapper wrapper) {
        return mapper.getPage(page,wrapper);
    }

    @Override
    @Transactional
    public boolean update(JmRealnameAuthentication auth) {
        JmRealnameAuthenticationLog log=new JmRealnameAuthenticationLog();
        BeanUtils.copyProperties(auth,log);
        logService.save(log);
        return super.updateById(auth);
    }
}
